package utilities;

import java.io.*;
import java.util.Calendar;
import java.util.GregorianCalendar;;

public class Logging {
		
	private Logging()
	{}
	
	public static void write(int i, String s)
	{
		Calendar t = new GregorianCalendar();
		
		String timeStr = "[" + t.get(Calendar.MONTH)+ "-" + t.get(Calendar.DAY_OF_MONTH)
		+ " "+ t.get(Calendar.HOUR_OF_DAY) + ":" + t.get(Calendar.MINUTE) + "]";
		
		File logs[] = new File[2];
		logs[0] = new File("QP.debug.log");
		logs[1] = new File("QP.errors.log");
		
		File log = logs[i];
		FileWriter x;
		try
		{
			x = new FileWriter(log, true);
			x.append(timeStr + " " + s + "\n");
			x.close();
		}
		catch(IOException ioEx)
		{
			System.out.println("Log file could not be opened\n" + ioEx);
		}
	}

}
